home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Online / SpeakFreely / src / Makefile < prev    next >
Makefile  |  2000-05-18  |  17KB  |  467 lines

  1.  
  2. #   Make file for Speak Freely for Unix
  3.  
  4. # Debugging options
  5.  
  6. DEBUG = -g -DHEXDUMP
  7. #DEBUG = -g -DHEXDUMP -DNOCRYPTO
  8. #DEBUG = -O
  9.   
  10. # Installation 
  11.  
  12. # Install program
  13. INSTALL = /usr/bin/install
  14. # Installation root directory
  15. INSTDIR = /usr/bin
  16. # Binaries
  17. INSTDIR_BIN = $(INSTDIR)/bin
  18. # Manual pages
  19. INSTDIR_MAN = $(INSTDIR)/man
  20.  
  21. #   Uncomment the appropriate CC, CCFLAGS, and LFLAGS statements below
  22. #   according to your machine type.
  23.  
  24. #                Linux
  25.  
  26. #    Linux users please note: many Linux audio drivers are
  27. #    half-duplex, even through your sound card may actually
  28. #    have full-duplex hardware.
  29. #
  30. #    The following settings are for the most "vanilla" Linux
  31. #    sound configuration.  This should work with the OSS/Free
  32. #    sound drivers and audio hardware which emulates a Sound
  33. #    Blaster Pro.  If you get long delays, try also adding
  34. #    -DLINUX_DSP_SMALL_BUFFER.    If you have fancier hardware
  35. #    and/or drivers it's wise to start out with simple settings
  36. #    like those below and experiment with fancier modes (for
  37. #    example, full duplex) only after you're sure the basic
  38. #    functionality is working.    Please see the detailed description
  39. #    of the available flags which follows these declarations.
  40. #
  41. CCFLAGS = 
  42. CC = gcc -O3 -m68040 -m68881 # for GNU's gcc compiler
  43. LFLAGS = -lncurses -lm
  44. #
  45. # If the above LFLAGS doesn't work, try the one below.
  46. #LFLAGS = -lcurses -ltermcap -lm
  47. #
  48. #   The following is a detailed description of these and other flags
  49. #   you may want to specify or not depending upon the details of your
  50. #   Linux sound configuration.
  51. #
  52. #    -DAUDIO_BLOCKING
  53. #        You almost always want to specify this.  If it's
  54. #        not present, Speak Freely may read short blocks of
  55. #        audio from the input source and send compressed
  56. #        packets filled with mostly silence.  The option is
  57. #        provided since it's required with some workstation
  58. #        audio hardware to avoid buffering problems.  However,
  59. #        some Linux configurations will encounter long delays
  60. #        between audio input and transmission which cannot be
  61. #        fixed entirely by setting the LINUX_DSP_SMALL_BUFFER and
  62. #        associated flags described below.  On such systems, you
  63. #        may need to also to build without AUDIO_BLOCKING defined.
  64. #        Such is the state of sound drivers for Linux that you may
  65. #        have to experiment with various settings of these
  66. #        variables to find a combination which works acceptably for
  67. #        your audio hardware and drivers.
  68. #
  69. #    -DHALF_DUPLEX
  70. #        Required if your audio hardware and/or driver does not
  71. #        permit simultaneous opening of the audio device for
  72. #        input and output by two separate programs.    As noted
  73. #        above, many Linux audio drivers are half duplex and
  74. #        require this flag even though the underlying audio hardware
  75. #        is full duplex.  Start by specifying this and then, if
  76. #        you believe your system capable of full duplex,
  77. #        experiment with turning it off.
  78. #
  79. #    -DIN_AUDIO_DEV=\"/dev/audio\"
  80. #    -DOUT_AUDIO_DEV=\"/dev/audio1\"
  81. #
  82. #        Some Linux audio drivers, for example the commercial
  83. #        OSS/Linux full-duplex driver, require full duplex programs
  84. #        to open separate /dev/audio and /dev/audio1 devices for
  85. #        input and output (or vice versa, presumably).  To
  86. #        configure the audio drivers in soundbyte.c to do this add
  87. #        the above to the CCFLAGS declaration.
  88. #
  89. #        If your make or shell has different opinions about how to
  90. #        get quotes all the way from a make macro to the C compiler
  91. #        command line, you may have to experiment with the quoting
  92. #        on these declarations.  As a last resort, just edit the
  93. #        top of soundbyte.c and hammer in hard-coded definitions of
  94. #        symbols IN_AUDIO_DEV and OUT_AUDIO_DEV.  You can set the
  95. #        input and output audio device file names to anything you
  96. #        wish, not just the values given above.
  97. #
  98. #    -DLINUX
  99. #        Required for all Linux configurations.
  100. #
  101. #    -DLINUX_DSP_SMALL_BUFFER
  102. #        Some Linux sound drivers default to a very large buffer
  103. #        for audio input, which results in long delays between
  104. #        the time audio is received by the microphone and when
  105. #        Speak Freely receives it to be transmitted.  Defining this
  106. #        symbol attempts to set the audio input buffer size to
  107. #        2048 bytes to minimise this delay.
  108. #
  109. #    -DFRAGMENT_BUFSIZE=32
  110. #    -DFRAGMENT_BUFPOWER=8
  111. #    
  112. #        Control the audio input buffer size.  Only works if
  113. #        LINUX_DSP_SMALL_BUFFER is also defined. The buffer size is 
  114. #        calculated as FRAGMENT_BUFSIZE * 2 ^ FRAGMENT_BUFPOWER.
  115. #        Big input buffers will delay when transmitting (input ->
  116. #        recording) while too small input buffers cause clipping.
  117. #        If you have still trouble reducing the delay, try compiling
  118. #        _without_ -DAUDIO_BLOCKING.
  119. #        For more details please refer to README.Linux_OSS_bufsize
  120. #        and soundinit() of soundbyte.c.  This code was developed
  121. #        and contributed by Walter Haidinger (walter.haidinger@gmx.at)
  122. #        who reports that the above values work for him, with no
  123. #        clipping with just about one second delay.    These values
  124. #        are applicable only to the OSS sound driver; defining them
  125. #        requires -DLINUX_DSP_SMALL_BUFFER also be defined,
  126. #        otherwise they will have no effect.
  127. #
  128. #    -DLINUX_FPU_FIX
  129. #        Some older C libraries on Intel-based Linux systems did
  130. #        not place the processor's floating point unit into default
  131. #        IEEE exception handling mode, which could result in
  132. #        program crashes due to harmless floating point underflows
  133. #        to zero which occur in the LPC compression library.
  134. #        Defining this symbol compiles in code which explicitly
  135. #        sets IEEE exception handling.
  136. #
  137. #    -DM_LITTLE_ENDIAN
  138. #        This symbol should be defined when compiling on "little-
  139. #        endian" platforms such as the Intel x86 series and
  140. #        clones.  Little-endian machines store multi-byte values
  141. #        with the least significant byte first in memory; big-endian
  142. #        machines store bytes in the opposite order.  This should
  143. #        be defined unless you're running on a big-endian processor
  144. #        (a SPARC, for example). 
  145. #
  146. #    -DNEEDED_LINEAR
  147. #        Some Linux audio drivers (for example, the OSS/Free [but
  148. #        *not* the commercial OSS/Linux drivers for the very same
  149. #        card] drivers for the Ensoniq AudioPCI card) do not
  150. #        support 8 bit mu-law I/O (which has been the default
  151. #        /dev/audio format since the first Sun workstations were
  152. #        shipped with audio in the late 1980's).  Defining this
  153. #        symbol compiles in code, developed and contributed by
  154. #        Jean-Marc Orliaguet, which translates between the 16 bit
  155. #        PCM audio used by such drivers and the 8 bit mu-law
  156. #        representation expected by Speak Freely.  If you're able
  157. #        to send and receive audio but the sound is horribly
  158. #        distorted, you may need to enable this.  If you're able to
  159. #        play the mu-law sound files included with Speak Freely,
  160. #        for example:
  161. #            cat ring.au >/dev/audio
  162. #        without distortion, then it's unlikely this option will help.
  163. #
  164. #   Another problem frequently encountered by Linux users is the
  165. #   permissions on the audio device.  To prevent eavesdropping, some
  166. #   Linux distributions require root privilege to open audio input.
  167. #   Unless you want to become root in order to run Speak Freely,
  168. #   you'll need to change the permissions on /dev/audio (or whatever)
  169. #   to allow regular users to open it for input.
  170.  
  171. #               Silicon Graphics
  172.  
  173. # In order to build Speak Freely, you need to have the dmedia_dev
  174. # packages installed.  In IRIX 5.3 and later, they are included with
  175. # The IRIX Development Option (IDO), but may not be installed by a
  176. # default installation of IDO. The command "versions dmedia_dev.sw"
  177. # will tell you whether these components are present on your system.
  178. # If they aren't, you need to install them before building Speak
  179. # Freely.
  180. #
  181. # The following options are optimal for IRIX 6.5 with C 7.2.1.
  182. # If you're compiling on an earlier version, adding the -float
  183. # option may speed up certain compression modes.  If you get a
  184. # warning about -float being ignored in non -cckr compiles, it
  185. # has no effect on your system.
  186. #CC = cc -signed
  187. #LFLAGS = -laudio -lcurses -lm
  188.  
  189. #                  Solaris 2.x
  190. #            (courtesy of Hans Werner Strube)
  191.  
  192. # (-fsingle is needed for pre-4.0 compilers and is ignored by 4.0 in
  193. # ANSI mode.)  Defining THREADS enables multi-threaded operation in
  194. # sflwld (and has no effect on any other component of Speak Freely).
  195. # THREADS has been tested on Solaris 2.5 through 2.7 (a.k.a. 7) SPARC
  196. # and requires POSIX thread support.  If you cannot build with THREADS
  197. # defined, simply remove it from the CCFLAGS line below.  If you
  198. # disable THREADS, you can also remove the "-lpthread" library
  199. # specification from the LFLAGS line, which may cause an error if the
  200. # system does not include the POSIX threads library.
  201.  
  202. #CC = cc -fsingle # for Sun Compiler
  203. #CCFLAGS = -DSolaris -DTHREADS
  204. #LFLAGS = -lcurses -lsocket -lnsl -lm -lpthread
  205.  
  206. #                 SunOS 4.1.x
  207.  
  208. #CC = cc -fsingle -DOLDCC
  209. #LFLAGS = -lcurses -ltermcap -lm
  210.  
  211. #                 FreeBSD 2.2
  212. #            (courtesy of Andrey A. Chernov)
  213.  
  214. #
  215. # ** FreeBSD users please note: many FreeBSD audio drivers are
  216. #    half-duplex, even through your sound card may actually
  217. #    have full-duplex hardware.  If you have trouble running
  218. #    sfmike and sfspeaker at the same time, try uncommenting
  219. #    the definition DUPLEX = -DHALF_DUPLEX later in this file.
  220. #    Depending on how your driver handles non-blocking I/O,
  221. #    you may also have to add -DAUDIO_BLOCKING to the
  222. #    CCFLAGS line.
  223. #CCFLAGS = -DM_LITTLE_ENDIAN
  224. #LFLAGS = -lcurses -ltermcap -lcompat -lm
  225.  
  226. #               Hewlett-Packard
  227. #              (courtesy of Marc Kilian)
  228. #
  229. #       PRELIMINARY--NOT FULLY TESTED
  230. #CC = cc
  231. #CCFLAGS = -DHEWLETT_PACKARD -DOLDCC
  232. #LFLAGS = -lAlib -lcurses -ltermcap -lm
  233.  
  234. # Where Perl is located on your system.  This is used to make
  235. # a directly-executable version of sfvod.
  236. PERL = /usr/bin/perl
  237.  
  238. # If your audio hardware is half duplex, uncomment the next line.
  239. # You can also, if you wish, define this on the CCFLAGS definition
  240. # for your hardware platform.
  241. #DUPLEX = -DHALF_DUPLEX
  242.  
  243. # If your getdomainname() does not return the DNS domainname, define:
  244. #DOMAIN=-DMYDOMAIN=\"somedomain.net\"
  245.  
  246. #   ################################################################
  247. #   ################################################################
  248.  
  249. #   Everything will probably work OK without any changes below
  250. #   this line.
  251.  
  252. #   Default Internet socket port used by sfmike and sfspeaker.    If you
  253. #   change this, you will not be able to exchange sound with users
  254. #   who've built Speak Freely with different values.  This default can
  255. #   be overridden by the "-Pport" option on sfspeaker and the ":port"
  256. #   hostname suffix in sfmike.    The ports used by Speak Freely are as
  257. #   follows:
  258. #
  259. #        INTERNET_PORT     UDP   Sound packets
  260. #        INTERNET_PORT+1   UDP   Control messages (RTCP)
  261. #        INTERNET_PORT+2   TCP   Communications with LWL server
  262. #
  263. #   If you don't publish your information or query an LWL server,
  264. #   INTERNET_PORT+2 is never used.
  265.  
  266. INTERNET_PORT = 2074
  267.  
  268. CARGS = -DInternet_Port=$(INTERNET_PORT)
  269.  
  270. #   Compiler flags
  271.  
  272. CFLAGS = $(DEBUG) -Iadpcm -Ilpc -Igsm/inc -Imd5 -Iidea -Ilibdes -Iblowfish $(CARGS) $(DUPLEX) $(CCFLAGS) $(DOMAIN)
  273.  
  274. PROGRAMS = sfspeaker sfmike sflaunch sflwld sflwl sfecho sfreflect sfvod
  275.  
  276. all:    $(PROGRAMS)
  277.  
  278. SPKROBJS = speaker.o codecs.o deskey.o g711.o rate.o rtpacket.o soundbyte.o ulaw.o usleep.o vatpkt.o vox.o audio_hp.o audio_sgi.o common.o
  279.  
  280. sfspeaker: $(SPKROBJS) adpcmlib.o libblowfish.o lpclib.o lpc10lib.o gsmlib.o deslib.o md5lib.o idealib.o libdes.o xdsub.o 
  281.     $(CC) $(SPKROBJS) adpcm/adpcm-u.o blowfish/libblowfish.a des/des.a md5/md5.o idea/idea.a lpc10/liblpc10.a gsm/lib/libgsm.a lpc/lpc.o xdsub.o libdes/libdes.a $(LFLAGS) -o sfspeaker
  282.  
  283. MIKEOBJS = mike.o codecs.o deskey.o g711.o rate.o rtpacket.o soundbyte.o ulaw.o usleep.o vatpkt.o xdsub.o audio_hp.o audio_sgi.o
  284.  
  285. sfmike: $(MIKEOBJS) adpcmlib.o libblowfish.o lpclib.o lpc10lib.o gsmlib.o deslib.o md5lib.o idealib.o libdes.o
  286.     $(CC) $(MIKEOBJS) adpcm/adpcm-u.o des/des.a md5/md5.o idea/idea.a -lm blowfish/libblowfish.a lpc10/liblpc10.a gsm/lib/libgsm.a lpc/lpc.o libdes/libdes.a $(LFLAGS) -o sfmike
  287.  
  288. LAUNCHOBJS = launch.o soundbyte.o usleep.o g711.o
  289.  
  290. sflaunch: $(LAUNCHOBJS)
  291.     $(CC) $(LAUNCHOBJS) $(LFLAGS) -o sflaunch
  292.  
  293. LWLDOBJS = lwld.o html.o xdsub.o
  294.  
  295. sflwld: $(LWLDOBJS)
  296.     $(CC) $(LWLDOBJS) $(LFLAGS) -o sflwld
  297.  
  298. LWLOBJS = lwl.o
  299.  
  300. sflwl:    $(LWLOBJS)
  301.     $(CC) $(LWLOBJS) $(LFLAGS) -o sflwl
  302.  
  303. ECHOOBJS = echo.o codecs.o g711.o rtpacket.o ulaw.o xdsub.o
  304.  
  305. sfecho: $(ECHOOBJS) md5lib.o
  306.     $(CC) $(ECHOOBJS) md5/md5.o adpcm/adpcm-u.o lpc/lpc.o $(LFLAGS) -o sfecho
  307.  
  308. REFLECTOBJS = reflect.o codecs.o html.o g711.o rtpacket.o ulaw.o xdsub.o
  309.  
  310. sfreflect: $(REFLECTOBJS) md5lib.o
  311.     $(CC) $(REFLECTOBJS) md5/md5.o adpcm/adpcm-u.o lpc/lpc.o $(LFLAGS) -o sfreflect
  312.  
  313. #    Configure the voice on demand server for the platform's
  314. #    location of Perl and network constant definitions.
  315.  
  316. sfvod:    sfvod.pl
  317.     echo \#\! $(PERL) >sfvod
  318.     echo \$$version = `tail -1 version.h`\; >>sfvod
  319.     echo '#include <stdio.h>' >sfvod-t.c
  320.     echo '#include <sys/types.h>' >>sfvod-t.c
  321.     echo '#include <sys/socket.h>' >>sfvod-t.c
  322.     echo 'main(){printf("$$AF_INET = %d; $$SOCK_DGRAM = %d;%c", AF_INET, SOCK_DGRAM, 10);return 0;}' >>sfvod-t.c
  323.     $(CC) sfvod-t.c -o sfvod-t
  324.     ./sfvod-t >>sfvod
  325.     rm sfvod-t.c sfvod-t
  326.     cat sfvod.pl >>sfvod
  327.     chmod 755 sfvod
  328.  
  329. #    Compression and encryption libraries.  Each of these creates
  330. #    a place-holder .o file in the main directory (which is not
  331. #    an actual object file, simply a place to hang a time and
  332. #    date stamp) to mark whether the library has been built.
  333. #    Note that if you actually modify a library you'll need to
  334. #    delete the place-holder or manually make within the library
  335. #    directory.  This is tacky but it avoids visiting all the
  336. #    library directories on every build and/or relying on features
  337. #    in make not necessarily available on all platforms.
  338.  
  339. adpcmlib.o:
  340.     ( echo "Building ADPCM library."; cd adpcm ; make CC="$(CC)" )
  341.     echo "ADPCM" >adpcmlib.o
  342.  
  343. deslib.o:
  344.     ( echo "Building DES library."; cd des ; make CC="$(CC) $(CCFLAGS)" )
  345.     echo "DES" >deslib.o
  346.  
  347. libblowfish.o:
  348.     ( echo "Building BLOWFISH library."; cd blowfish ; make CC="$(CC) $(CCFLAGS) $(DEBUG)" )
  349.     echo "BLOWFISH" >libblowfish.o
  350.  
  351. libdes.o:
  352.     ( echo "Building LIBDES library."; cd libdes ; make -f Makefile.sf CC="$(CC) $(CCFLAGS) $(DEBUG)" )
  353.     echo "LIBDES" >libdes.o
  354.  
  355. lpclib.o:
  356.     ( echo "Building LPC library."; cd lpc ; make CC="$(CC) $(CCFLAGS) $(DEBUG)" )
  357.     echo "LPC" >lpclib.o
  358.  
  359. lpc10lib.o:
  360.     ( echo "Building LPC10 library."; cd lpc10 ; make CC="$(CC) $(CCFLAGS) $(DEBUG)" )
  361.     echo "LPC" >lpc10lib.o
  362.  
  363. gsmlib.o:
  364.     ( echo "Building GSM library."; cd gsm ; make CC="$(CC)" )
  365.     echo "GSM" >gsmlib.o
  366.  
  367. md5lib.o:
  368.     ( echo "Building MD5 library."; cd md5 ; make CC="$(CC)" )
  369.     echo "MD5" >md5lib.o
  370.  
  371. idealib.o:
  372.     ( echo "Building IDEA library."; cd idea ; make CC="$(CC)" )
  373.     echo "IDEA" >idealib.o
  374.  
  375. #   Object file dependencies
  376.  
  377. codecs.o:   codecs.c speakfree.h
  378.  
  379. common.o:   common.c  common.h
  380.  
  381. html.o: html.c
  382.  
  383. mike.o: mike.c speakfree.h version.h
  384.  
  385. launch.o: launch.c speakfree.h version.h
  386.  
  387. lwl.o:    lwl.c speakfree.h version.h
  388.  
  389. lwld.o: lwld.c speakfree.h version.h
  390.  
  391. echo.o: echo.c speakfree.h vat.h version.h
  392.  
  393. reflect.o: reflect.c speakfree.h vat.h version.h
  394.  
  395. rtpacket.o: rtpacket.c speakfree.h rtp.h
  396.  
  397. soundbyte.o: Makefile soundbyte.c speakfree.h
  398.  
  399. speaker.o: speaker.c speakfree.h version.h
  400.  
  401. vatpkt.o:   vatpkt.c speakfree.h vat.h
  402.  
  403. speakfree.h:    audio_descr.h rtp.h rtpacket.h ulaw2linear.h types.h
  404.  
  405. testgsm:    testgsm.o gsmlib.o
  406.     $(CC) testgsm.o -lm gsm/lib/libgsm.a $(LFLAGS) -o testgsm
  407.  
  408. manpage:
  409.     nroff -man sfmike.1 | $(PAGER)
  410.     nroff -man sfspeaker.1 | $(PAGER)
  411.     nroff -man sflaunch.1 | $(PAGER)
  412.     nroff -man sflwl.1 | $(PAGER)
  413.     nroff -man sflwld.1 | $(PAGER)
  414.     nroff -man sfecho.1 | $(PAGER)
  415.     nroff -man sfreflect.1 | $(PAGER)
  416.     nroff -man sfvod.1 | $(PAGER)
  417.  
  418. #    Process NROFF manual pages into cat-able .man pages
  419.  
  420. mantext:
  421.     nroff -man sfmike.1 | col -b >/tmp/sfmike.man
  422.     nroff -man sfspeaker.1 | col -b >/tmp/sfspeaker.man
  423.     nroff -man sflaunch.1 | col -b >/tmp/sfspeaker.man
  424.     nroff -man sflwl.1 | col -b >/tmp/sflwl.man
  425.     nroff -man sflwld.1 | col -b >/tmp/sflwld.man
  426.     nroff -man sfecho.1 | col -b >/tmp/sfecho.man
  427.     nroff -man sfreflect.1 | col -b >/tmp/sfecho.man
  428.     nroff -man sfvod.1 | col -b >/tmp/sfvod.man
  429.  
  430. #    Print manual pages for all programs.  Assumes you have "ptroff"
  431.  
  432. printman:
  433.     ptroff -man sfmike.1
  434.     ptroff -man sfspeaker.1
  435.     ptroff -man sflaunch.1
  436.     ptroff -man sflwl.1
  437.     ptroff -man sflwld.1
  438.     ptroff -man sfecho.1
  439.     ptroff -man sfreflect.1
  440.     ptroff -man sfvod.1
  441.  
  442. #    Clean everything
  443.  
  444. clean:
  445.     rm -f core *.out *.o *.bak $(PROGRAMS) *.shar sfvod-t*
  446.     ( cd adpcm; make clean )
  447.     ( cd blowfish; make clean )
  448.     ( cd libdes; make clean )
  449.     ( cd lpc; make clean )
  450.     ( cd lpc10; make clean )
  451.     ( cd gsm; make clean )
  452.     ( cd des; make clean )
  453.     ( cd md5; make clean )
  454.     ( cd idea; make clean )
  455.  
  456. #    Clean only the main directory, not the libraries
  457.  
  458. dusty:
  459.     rm -f core *.out *.o *.bak $(PROGRAMS) *.shar sfvod-t*
  460.  
  461. #    Install binaries and manual pages.  You'll need to
  462. #    be root to install in system directories.
  463.  
  464. install: $(PROGRAMS)
  465.     $(INSTALL) -o root -g root -m 755 -s $(PROGRAMS) $(INSTDIR_BIN)
  466.     $(INSTALL) -o root -g root -m 644 *.1 $(INSTDIR_MAN)/man1
  467.